package schoolWork.work03.Example1;

public class Car extends Vehicle {
    private String licensePlateNumber;

    public Car() {
        this.setNumberOfTires(4);
        this.licensePlateNumber = "?????? ?";
        System.out.println("this is son constructor without params. ");
    }

    public Car(String brand, int numberOfTires, String licensePlateNumber) {
        super(brand, numberOfTires);  //写在第一句调用了父类的构造方法
        this.licensePlateNumber = licensePlateNumber;
        System.out.println("this is son constructor with params. ");
    }

    public String getLicensePlateNumber() {
        return this.licensePlateNumber;
    }

    public void setLicensePlateNumber(String newValue) {
        this.licensePlateNumber = newValue;
    }

    @Override
    void showInfo() {//覆盖了父类的showInfo
        super.showInfo();//用super调用父类的showInfo
        System.out.println("license : " + this.getLicensePlateNumber());
    }

}
